Skip to content

Conversation

@r-downing
Copy link

@r-downing r-downing commented Mar 28, 2025

fixes #1036 where tests fail with default-branch main

@r-downing r-downing changed the title Fixes https://github.com/pre-commit/pre-commit-hooks/issues/1036 Fixes #1036 Mar 28, 2025
Copy link
Member

@asottile asottile left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

took a different approach in #1158 which doesn't need to query the actual default branch

also in the future please use a more useful commit message and PR title -- it's super unclear what you're actually changing or improving given the title of this PR



def get_default_branch():
ret = subprocess.getoutput('git config init.defaultBranch').strip()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

subprocess.getoutput should really never be used -- it invokes a shell

@asottile asottile closed this Apr 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

tests fail with init.defaultBranch set to main

2 participants